<template>
  <div>
    <!-- 公共Map类型 -->
    <map-type  ref="mapType"/>
    <!-- 公共自定义选项 -->
    <custom-options  :customOptionValue="customOptionVal" ref="sinkMapTab_customOption"/>
  </div>
</template>

<script>
import MapType from "./MapType";
import CustomOptions from "./CustomOptions";
export default {
  components: {
    MapType,
    CustomOptions,
  },
  props: {
    sinkMap: {
      type: Array,
      default:() => [],
    }
  },
  data() {
    return {
      customOptionVal:[]
    };
  },
  watch:{
    sinkMap: {
      handler: function(newData,oldData) {
        if(''!==newData && newData !=undefined){
          if(newData.options!=undefined && newData.options.length>0){
            let tempdata= newData.options//获取到的是数组对象
            tempdata.forEach((item,index,arr)=>{
              let temp1=item.split('=')
              //var dd=temp1[1].replace(/^\"|\"$/g,'')
              let key1=temp1[0].trim();
              var value1=temp1[1].trim().replace(/\"/g, "")
              let temp={key:key1,value:value1}
              this.customOptionVal.push(temp)
            })
          }
        }
      },
      immediate: true,
      deep: true
    }
  },
  mounted() {},
  methods: {},
};
</script>

<style>
</style>
